<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

date_default_timezone_set("UTC");
//define('AD', 'AddDomain');
define('DD', 'DescribeDomains');
//define('DDI', 'DescribeDomainInfo');
//define('ADR', 'AddDomainRecord');
define('UDR', 'UpdateDomainRecord');
//define('SDR', 'SetDomainRecordStatus');
define('DDR', 'DescribeDomainRecords');
define('DDRI', 'DescribeDomainRecordInfo');
define('GET', 'GET'); //定义全局提交请求的HTTP方法
//设置数据库信息
//设置PDO长语句
define('PDOTEXT', 'mysql:host=localhost;dbname=heidomain');
//设置数据库连接的用户和密码 端口
define('DBUSER', 'root');
define('DBPASSWD', '123456');
define('DBHOST', '3306');
define('DBNAME', 'heidomain');
define('DBSERVER', 'localhost');

//Sign密钥生成函数
function MakeSign($email, $aki, $aks) {
    $key = $aki . $aks;
    return base64_encode(hash_hmac("sha1", $email, $key, true));
}

//json数据处理过滤函数
function FilterJson($jsondata) {
    $jsondata = json_decode($jsondata,True);
}

//获取AKI和AKS函数
function GetKeys($uid) {
    $PdoConnect = new PDO(PDOTEXT, DBUSER, DBPASSWD);
    $Content = $PdoConnect->prepare('SELECT AccessKeyId, AccessKeySecret FROM user_info WHERE uid=:uid');
    $Content->execute(array(':uid' => $uid));
    $Return_data = $Content->fetch(PDO::FETCH_ASSOC);
    return $Return_data;
}